Dynomotion

Group: DynoMotion Message: 11585 From: cnc_machines Date: 5/27/2015
Subject: KStep Spindle
I have been having a lot of trouble with getting my spindle running properly with the KStep. I think this is because the POT on my motor controller doesnt have a linear response. When I check RPM with a tachometer I get crazy RPM values. My RPM could be within a few hundred and it wouldnt matter - Max spindle speed is 3,300 RPM.

I am wondering if there is a way to make my own table based off of test RPM Data? To do this I have a few questions:

  1. What type of value is   FPGA(IO_PWMS) expecting? Something between 1-100?
  2. Could I manually input values for   FPGA(IO_PWMS) and check actual Spindle rpm?
  3. I have been spending a lot of time trying to figure out how the CorrectAnalog program works. I am thinking I could update the table in that file with actual Spindle RPM to get my speed in the ballpark of what my tachometer reads. Any idea if this is possible?

#define RPM_FACTOR 3300 // RPM for full duty cycle (max analog out)

// desired speed is passed in variable 1


main()
{
    float speed = *(float *)&persist.UserData[1];  // value stored is actually a float
   
    FPGA(KAN_TRIG_REG)=4;              // Mux PWM0 to JP7 Pin5 IO 44 for KSTEP
    SetBitDirection(44,1);          // define bit as an output
    FPGA(IO_PWMS_PRESCALE) = 46;      // divide clock by 46 (1.4 KHz)
    FPGA(IO_PWMS+1) = 1;              // Enable
   


    FPGA(IO_PWMS) = CorrectAnalog(speed/RPM_FACTOR);      // Set PWM   


Thanks,


Scott

Group: DynoMotion Message: 11601 From: cnc_machines Date: 5/29/2015
Subject: Re: KStep Spindle
Tom,

This post has been buried with a lot of other ones. Just wondering if you had a chance to look at it or had any suggestions.

Thanks,

Scott
Group: DynoMotion Message: 11602 From: Tom Kerekes Date: 5/29/2015
Subject: Re: KStep Spindle
Hi Scott,

(I guess this didn't send.  resending...)

Yes you can create code to correct for non linearities
What do you mean by "crazy values".  Can you make a table?

The KSTEP Analog output should be reasonably linear away from values near zero as shown here (toward end of page)


#1 - the PWMs are 8-bit PWMs that accept a setting from 0 to 255

#2 - of course.  See the PWM 1KHz example.  But use the same Pre-scale that you intend to use (ie 46) as the nonlinearity will be somewhat dependent on PWM Frequency.

#3 - the CorrectAnalog is not written to be concerned with actual RPM.  It is designed to linearize the response over a range of 0-1.  After the response is linear you should just be able to scale it externally.

HTH
Regards
TK